<?php
   error_reporting(0);
   header("Content-Type: text/plain;charset=utf-8"); 

   $citya=array
   (
      array("a"=>"长春", "b"=>"吉林", "c"=>"四平", "d"=>"延吉"),
      array("a"=>"成都", "b"=>"绵阳", "c"=>"泸州", "d"=>"德阳"),
      array("a"=>"杭州", "b"=>"宁波", "c"=>"绍兴", "d"=>"温州")
   );

   $cityb=array
   (
      array("a"=>"市1县1", "b"=>"市1县2", "c"=>"市1县3", "d"=>"市1县4"),
      array("a"=>"市2县1", "b"=>"市2县2", "c"=>"市2县3", "d"=>"市2县4"),
      array("a"=>"市3县1", "b"=>"市3县2", "c"=>"市3县3", "d"=>"市3县4"),
      array("a"=>"市4县1", "b"=>"市4县2", "c"=>"市4县3", "d"=>"市4县4"),
   );

   $usera=array
   (
      array("a"=>"A00001","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼101号","e"=>"有待认证","f"=>"王栋"),
      array("a"=>"A00002","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼201号","e"=>"未认证","f"=>"王栋"),
      array("a"=>"A00003","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼301号","e"=>"已认证","f"=>"王栋"),
      array("a"=>"A00004","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼401号","e"=>"有待认证","f"=>"王栋"),
      array("a"=>"A00005","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼501号","e"=>"未认证","f"=>"王栋"),
      array("a"=>"A00006","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼601号","e"=>"已认证","f"=>"王栋"),
      array("a"=>"A00007","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼701号","e"=>"有待认证","f"=>"王栋"),
      array("a"=>"A00008","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼801号","e"=>"未认证","f"=>"王栋"),
      array("a"=>"A00009","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼901号","e"=>"已认证","f"=>"王栋"),
      array("a"=>"A00010","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼111号","e"=>"有待认证","f"=>"王栋"),
      array("a"=>"A00011","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼121号","e"=>"未认证","f"=>"王栋"),
      array("a"=>"A00012","b"=>"wopelo","c"=>"66666666666","d"=>"A栋一楼131号","e"=>"已认证","f"=>"王栋"),
   );
   
  
   
   if ($_SERVER["REQUEST_METHOD"] == "GET"&&$_GET["numbera"]){
       downa();
   }
   else if($_SERVER["REQUEST_METHOD"] == "GET"&&$_GET["numberb"]){
       downb();
   }
   else if($_SERVER["REQUEST_METHOD"] == "GET"&&$_GET["numberc"]){
       downc();
   }
   else if($_SERVER["REQUEST_METHOD"] == "GET"&&$_GET["numberd"]){
       downd();
   }
   else if($_SERVER["REQUEST_METHOD"] == "GET"&&$_GET["numberf"]){
       downe();
   }
   else{
       addNew();
   }

   function downa(){
       global $citya;
       $numbera=$_GET["numbera"];
       if (!isset($numbera)||empty($numbera)){
		       echo "参数错误";
	     }
       else if($numbera=="jl"){
           echo json_encode($citya[0],JSON_UNESCAPED_UNICODE);
       } 
       else if($numbera=="sc"){
           echo json_encode($citya[1],JSON_UNESCAPED_UNICODE);
       }
       else if($numbera=="zj"){
           echo json_encode($citya[2],JSON_UNESCAPED_UNICODE);
       }
  }

  function downb(){
       global $cityb;
       $numberb=$_GET["numberb"];
       if (!isset($numberb)||empty($numberb)){
           echo "参数错误";
       }
       else if($numberb=="selectba"){
           echo json_encode($cityb[0],JSON_UNESCAPED_UNICODE);
       } 
       else if($numberb=="selectbb"){
           echo json_encode($cityb[1],JSON_UNESCAPED_UNICODE);
       }
       else if($numberb=="selectbc"){
           echo json_encode($cityb[2],JSON_UNESCAPED_UNICODE);
       }
       else if($numberb=="selectbd"){
           echo json_encode($cityb[3],JSON_UNESCAPED_UNICODE);
       }
  }

  function addNew(){
     $aa=array();
     $back='{"a":"成功","b":"","c":""}';
     $aa[0]=$_POST["sf"];
     $aa[1]=$_POST["cs"];
     $aa[2]=$_POST["qx"];
     for($n=0;$n<2;$n++){
         if (!isset($aa[$n])||empty($aa[$n])){
            $back='{"a":"参数错误","b":"","c":""}';
         }
     }
     echo $back;
  }

  function downc(){
     global $cityb;
     echo json_encode($cityb,JSON_UNESCAPED_UNICODE);
  }

  function downd(){
     global $usera;
     echo json_encode($usera,JSON_UNESCAPED_UNICODE);
  }

  function downe(){
     $a=array();
     $a[0]=$_GET["numberf"];
     $a[1]=$_GET["numberg"];
     echo json_encode($a,JSON_UNESCAPED_UNICODE);
  }
?>